package com.janj.dao;

import com.janj.bean.Course;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CourseOnStudentMapper {


    @Select("SELECT * FROM course")
    @Results({
            @Result(column = "cid", property = "cid"),
            @Result(column = "cname", property = "cname"),
            @Result(
                    column = "cid",
                    property = "students",
                    javaType = List.class,
                     many=@Many(select = "com.janj.dao.StudentMapper.selectStudentByCid")
            )
    })
    public abstract List<Course> selectCourseOnStudent();
}
